package yu.liu.personal.app.myapplication.ui.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import yu.liu.personal.app.myapplication.utils.ResourceManager;

/**
 * Created by Administrator on 2016/9/25.
 */

public abstract class BaseFragment extends Fragment {
    protected Context resContext;
    protected ResourceManager resManager;
    protected View fragmentView;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        resContext = context;
        resManager = ResourceManager.getManager(resContext);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        fragmentView = loadViews(inflater);;
        loadMembers();
        postSetup();
        return fragmentView;
    }

    protected abstract View loadViews(LayoutInflater inflater);

    protected abstract void loadMembers();

    protected abstract void postSetup();

    protected abstract void updateViews();
}
